import {
    CallApi
} from './base';
import {
    StringUpdater
} from 'js/utils/string_update';
import Base64 from 'js/lib/base64';


export let LoginApi = {

    getConnectInfo(data, cb) {
        data = {
            username: StringUpdater.mode1.update(Base64.toBase64(data.username)),
            password: StringUpdater.mode1.update(Base64.toBase64(data.password))
        };
        CallApi('Login.asmx/GetConnectInfo', data, cb)
    },
    login(username, password, cid, cb) {
        let data = {
            UserName: StringUpdater.mode1.update(Base64.toBase64(username)),
            PassWord: StringUpdater.mode1.update(Base64.toBase64(password)),
            Cid: cid
        }
        CallApi('Login.asmx/Login', data, cb)
    }
}